import networkx as nx

# 读取数据集
G = nx.read_edgelist('email-Network.txt', create_using=nx.DiGraph())
# department_labels因为只有一个‘部门’属性用字典的方式存储
department_labels = {}
with open('email-Department.txt', 'r') as file:
    for line in file:
        # split()默认以空格的方式分割
        node, label = line.strip().split()
        department_labels[node] = label
# 将部门标签信息添加到节点属性中
nx.set_node_attributes(G, department_labels, 'department')


# 边介数指数
# edge_betweenness_centrality=nx.edge_betweenness_centrality(G)

# for edge in G.edges:
#     original_tuple = edge
#     new_tuple = tuple(map(int, original_tuple))
#     print(edge_betweenness_centrality[edge])




